package com.zwd.cases.demo.gof23.factory.day20221226;

import com.zwd.cases.demo.gof23.factory.day20221226.domain.CheesePizza;
import com.zwd.cases.demo.gof23.factory.day20221226.domain.GreekPizza;
import com.zwd.cases.demo.gof23.factory.day20221226.domain.PepperPizza;
import com.zwd.cases.demo.gof23.factory.day20221226.domain.Pizza;

/**
 * @Description 简单工厂类（1.0版本）
 * @Author zhengwd
 * @Date 2022/12/26 10:18
 **/
public class SimplePizzaFactory {

    public Pizza createPizza(String ordertype) {
        if ("cheese".equals(ordertype)) {
            return new CheesePizza();
        } else if ("greek".equals(ordertype)) {
            return new GreekPizza();
        }
        else if ("pepper".equals(ordertype)) {
            return new PepperPizza();
        }
        return null;
    }
}
